<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="ManageContracts.aspx.vb" Inherits="Default2" title="GTS Frieght Management System"  MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <h3>
        Manage Contracts</h3>
    <asp:Label ID="Message" runat="server" Text=""></asp:Label>
    <table width="100%">
        <tr>
            <td colspan="2" style="height: 24px">
                <asp:Label ID="lblCarrier" runat="server" Text="Select Carrier:" Font-Bold="True"></asp:Label>&nbsp;<asp:DropDownList ID="ddlCarrier" runat="server" AutoPostBack="True" DataSourceID="CarrierContractDataSource" DataTextField="CarrierName" DataValueField="CarrierID" Width="213px">
                </asp:DropDownList></td>
        </tr>
        <tr>
            <td style="height: 22px; text-align: center;">
                <asp:Label ID="lblStartDate" runat="server" Text="Contract Start Date:" Font-Bold="True"></asp:Label></td>
            <td style="height: 22px; text-align: center;">
                <asp:Label ID="lblEndDate" runat="server" Text="Contract End Date:" Font-Bold="True"></asp:Label></td>
        </tr>
        <tr>
            <td style="text-align: center"><asp:Calendar ID="StartDate" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="122px" NextPrevFormat="ShortMonth" Width="227px">
                <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                <TodayDayStyle BackColor="#999999" ForeColor="White" />
                <DayStyle BackColor="#CCCCCC" />
                <OtherMonthDayStyle ForeColor="#999999" />
                <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
                <DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
                <TitleStyle BackColor="#333399" BorderStyle="Solid" Font-Bold="True" Font-Size="12pt"
                    ForeColor="White" Height="12pt" />
            </asp:Calendar>
            </td>
            <td style="text-align: center"><asp:Calendar ID="EndDate" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="122px" NextPrevFormat="ShortMonth" Width="227px">
                <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                <TodayDayStyle BackColor="#999999" ForeColor="White" />
                <DayStyle BackColor="#CCCCCC" />
                <OtherMonthDayStyle ForeColor="#999999" />
                <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
                <DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
                <TitleStyle BackColor="#333399" BorderStyle="Solid" Font-Bold="True" Font-Size="12pt"
                    ForeColor="White" Height="12pt" />
            </asp:Calendar>
            </td>
        </tr>
        <tr>
            <td>
                </td>
            <td style="text-align: right">
                <asp:LinkButton ID="btnAdd" runat="server" Width="98px">Add</asp:LinkButton></td>
        </tr>
    </table>
    <h4>
        You currently have contracts with:</h4>

        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="4" DataKeyNames="ContractID" DataSourceID="ContractInfoDataSource"
            ForeColor="#333333" GridLines="None" PageSize="4" Width="100%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="CarrierName" HeaderText="Carrier Name" ReadOnly="True"
                    SortExpression="Carrier Name" />
                <asp:BoundField DataField="ContractStart" HeaderText="Contract Start" ReadOnly="True"
                    SortExpression="Contract Start" />
                <asp:BoundField DataField="ContractEnd" HeaderText="Contract End" ReadOnly="True"
                    SortExpression="Contract End" />
                <asp:TemplateField HeaderText="Status" SortExpression="Status">
                    <EditItemTemplate>
                        &nbsp;<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="StatusDataSource"
                            DataTextField="StatusName" DataValueField="StatusID" SelectedValue='<%# Bind("StatusID") %>'>
                        </asp:DropDownList><asp:ObjectDataSource ID="StatusDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="getStatus" TypeName="GTSSystem.BLL.Status"></asp:ObjectDataSource>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("StatusName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:ObjectDataSource ID="ContractInfoDataSource" runat="server" OldValuesParameterFormatString="{0}"
            SelectMethod="GetContractInfoByClientBranchID" TypeName="GTSSystem.BLL.Contract"
            UpdateMethod="UpdateStatus">
            <UpdateParameters>
                <asp:Parameter Name="ContractID" Type="Int32" />
                <asp:Parameter Name="StatusID" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:ProfileParameter Name="ClientBranchID" PropertyName="BranchId" Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="ClientID" Type="Int32" />
                <asp:Parameter Name="ClientBranchID" Type="Int32" />
                <asp:Parameter Name="CarrierID" Type="Int32" />
                <asp:Parameter Name="ContractStartDate" Type="DateTime" />
                <asp:Parameter Name="ContractEndDate" Type="DateTime" />
            </InsertParameters>
        </asp:ObjectDataSource>
      
    <asp:ObjectDataSource ID="CarrierContractDataSource" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetContractInfoByClientBranchID"
        TypeName="GTSSystem.BLL.Contract" UpdateMethod="UpdateStatus">
        <SelectParameters>
            <asp:ProfileParameter Name="ClientBranchID" PropertyName="BranchId" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="ContractID" Type="Int32" />
            <asp:Parameter Name="StatusID" Type="Int32" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>

